<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-5-21
 * Time: 下午7:46
 */

class Mphotodetail extends CI_Model{
    function __construct(){
        parent::__construct();
    }

    /**
     * 照片喜欢明细
     * @param $photoId
     * @param $uid
     * @return mixed
     */
    function installPhotoDetail($photoId,$uid)
    {
        $sql = "insert into `tbphoto_detail`(photo_id,uid) values(?,?)";
        $query = $this->db->query($sql,array($photoId,$uid));
        return $this->db->affected_rows();
    }

    /**
     * 检测用户是否已标记过
     * @param $photoId
     * @param $uid
     * @return bool
     */
    function checkPhotoMake($photoId,$uid)
    {
        $sql = "select * from `tbphoto_detail` where `photo_id` = ? and `uid`=? limit 1";
        $query = $this->db->query($sql,array($photoId,$uid));
        $data = $query->row_array();

        if(empty($data)){
            return true;
        }
        return false;
    }

}